package framework

import (
	"GoWeb/src/model"
	"encoding/json"
	"io"
	"net/http"
)

func ResultOk(w http.ResponseWriter, data string) {
	io.WriteString(w, data)
}

func ResultFail(w http.ResponseWriter, err string) {
	http.Error(w, err, http.StatusOK)//StatusBadRequest
}
//data interface{}
func ResultJsonOk(w http.ResponseWriter,data []model.User ) {
	w.Header().Set("Content-Type", "application/json")
	//json, _ := json.Marshal(data)
	result := &model.ResultData{}
	result.Code = 1
	result.Data=data
	result.Msg=""
	json, _ := json.Marshal(result)
	w.Write(json)
}
